#pragma once

class CMemoryMap
{
public:
	CMemoryMap();
	~CMemoryMap();
	CMemoryMap(CString csMapKey, DWORD dwMaxSize,BOOL bAutoRelease = TRUE);
	HANDLE Create(CString csMapKey, DWORD dwMaxSize,BOOL bAutoRelease = TRUE);
	HANDLE Open(CString csMapKey);
	BOOL Flush();
	void Release();

	CString GetMapKey();
	LPVOID GetMemoryMapPtr();
private:
	CString& _CreateMappingName(CString& csMapKey);
private:
	HANDLE  m_hMemoryMap;
	CString m_csMapKey;
	LPVOID  m_lpMemoryMapPtr;
	DWORD   m_dwMaxSize;
	BOOL m_bAutoRelease;

};
